<include file="Public/head" />
<link type="text/css" rel="stylesheet" href="{:get_style_cdnurl()}paimai/yunying/css/cashier.css" />
<include file="Public/common_header" />
<div class="mian">
    <div class="mianL">
        <include file="Public/sidebar" menu="jybggl.zysh"/>
    </div>
        <div class="mianR">

			<h3 class="yonghu">上次变更信息</h3>
 			<div class="arbitration">
 				<table>
 					<tbody>
 						<tr>
                            <td>拍单号</td><td>{$res.order_no}</td>
                            <td>变更单号</td><td>{$res.last_modify_no}</td>
                        </tr>
 						<tr>
                            <td>变更原因</td><td>{$res.}</td>
                            <td>变更状态</td><td>{$res.}</td>
                        </tr>
 						<tr>
                            <td>变更时间</td><td>{$res.}</td>
                            <td>变更描述</td><td>{$res.}</td>
                        </tr>
 					</tbody>
 				</table>
 			</div>

            <h3 class="yonghu">仲裁审核</h3>
 			<div class="arbitration">
 				<table>
 					<tbody>
 						<tr>
                            <td>车辆名称</td><td>{$res.model}</td>
                            <td>拍单号</td><td>{$res.order_no}</td>
                        </tr>
 						<tr>
                            <td>车辆编号</td><td>{$res.car_no}</td>
                            <td>发起时间</td><td>{$res.createtime}</td>
                        </tr>
 						<tr> 
                        <?php if ($res['od_type'] == 1): ?>
                            <td>车商姓名</td><td>{$res.dealer_name}</td>
                            <td>车商电话</td><td>{$res.dealer_phone}</td>
                        <?php else :?>
                            <td>车主姓名</td><td>{$res.owner_name}</td>
                            <td>车主电话</td><td>{$res.owner_phone}</td>
                        <?php endif ?>
                            
                        </tr>
 						<tr>
                            <td>争议原因</td><td><?php echo $dispute_reason[$res['dispute_reason']]; ?></td>
                            <td>审核状态</td><td>待审核</td>
                        </tr>
 						<tr>
                            <td>争议说明</td><td colspan="3">{$res.remark}</td>
                        </tr>
 						<tr><td>审核结果</td>  
 						<td colspan="3" align="left">
 							<div class="findings-audit">
	 						<input type="radio" value="1" checked="checked" name="adoptName" id="adopt"><label for="adopt">通过</label>
	 						<input type="radio" value="2" name="adoptName" id="reject"><label for="reject">驳回</label>
	 						<input type="radio" value="3" name="adoptName" id="default"><label for="default">违约</label>
	 						</div>
 						</td>
 						</tr>
 					</tbody>
 				</table>
 			</div>
 			<h3 class="yonghu">拍单变更单信息</h3>
 			<div class="arbitration">
 				<table>
 					<tbody>
 						<tr>
                            <td width="15%">车辆名称</td>
                            <td colspan="3">{$res.model}</td>
                        </tr>
 						<tr>
                            <td width="15%">车辆编号</td>
                            <td width="35%">{$res.car_no}</td>
                            <td width="15%">拍单号</td>
                            <td width="35%">{$res.order_no}</td>
                        </tr>
 						<tr><td>变更原因</td>
 						<td align="left">
 							<div class="change-reason">
 								<?php if ($res['od_type'] == 1): ?>
 									<input type="radio" checked="checked" name="testing" value="1" id="testing"><label for="testing">检测失误</label>
	 								<input type="radio" name="testing" value="2" id="testing1"><label for="testing1">平台失误</label>
 								<?php else:?>
									<input type="radio" checked="checked" name="testing" value="2" id="testing1"><label for="testing1">平台失误</label>
 								<?php endif ?>
 								
	 						</div>
 							<div class="change-reason1" style="display:none;">
 								<input type="radio" checked="checked" name="buyDefault" value="1" id="buyDefault"><label for="buyDefault">买方违约</label>
	 							<input type="radio" name="buyDefault" value="2" id="buyDefault1"><label for="buyDefault1">卖方违约</label>
	 						</div>
	 					</td>
	 					<td rowspan="2">变更描述</td><td rowspan="2" align="left"><textarea placeholder="描述" class="change-describe"></textarea></td>
 						</tr>
	 					<tr style="border: none;">
	 						<td>变更结果</td>
	 						<td align="left">
	 							<div class="compensate">
 									<input type="radio" checked="checked" name="Payment" value="1" id="Payment"><label for="Payment">赔付</label>
	 								<input type="radio" name="Payment" value="2" id="Payment1"><label for="Payment1">订单关闭</label>
	 							</div>
	 						</td>
	 						<td style="border: none;"></td>
	 						<td style="border: none;"></td>	 			
	 					</tr>
 					</tbody>
 				</table>
 			</div>
 			<?php if ($res['od_type'] == 1): ?>
				<h3 class="yonghu">车商处理</h3>
			<?php else:?>
				<h3 class="yonghu">车主处理</h3>
			<?php endif ?>
			<div class="cost-money">赔付金额<input type="text" value="" name='payment_amount' onkeyup="this.value=this.value.replace(/\D/g,'')" /><span>元</span></div>
 			<div class="arbitration" style="display: none;">
 				<table>
 					<thead><tr><td>关联单据</td><td>费用项</td><td>退/赔项</td><td>收扣款项</td></tr></thead>
 					<tbody>
 						<tr><td width="20%">拍单号：P123456789</td><td width="30%"><span>应收车款：100000元</span><span>实收车款：80000元</span></td><td width="30%">应退车款：80000元</td><td width="20%">10000</td></tr>
 						<tr><td>退车赔款</td><td></td><td><span class="cash-money">
 							<input type="text" name="voucher" id="voucher1" /><label for="voucher1">现金</label>
 						</span><span class="cash-money1" style="display: none;"></span></td><td></td></tr>
 						<tr><td>违约扣款</td><td></td><td></td><td>扣除违约金：2000元</td></tr>
 						<tr><td>小计</td><td colspan="2"></td><td>争议赔付+保证金</td></tr>
 					</tbody>
 				</table>
 			</div>
 			<!-- <div class="cost-money1" style="display: none;">财务退款<input type="text" value="" onkeyup="this.value=this.value.replace(/\D/g,'')" /><span>元</span></div> -->
 			<div class="refund">
 				<h3>买方收款账号</h3>
 				<ul class="clearfix">
 					<li><span>开户名：</span><input type="text" value="" name="account_name" /></li>
 					<li><span>银行帐号：</span><input type="text" value="" name="bank_account" /></li>
 					<li><span>银行名称：</span><input type="text" value="" name="bank_name"></li>
 				</ul>
 			</div>
 			<div class="reason-rejection clearfix" style="display: none;">
 				<span>驳回原因</span><textarea id="reject_result"></textarea>
 			</div>
 			<h3 class="yonghu" style="display: none;">车主处置</h3>
 			<div class="arbitration" style="display: none;">
 				<table>
 					<thead><tr><td>关联单据</td><td>费用项</td><td>退/赔项</td><td>收扣款项</td></tr></thead>
 					<tbody>
 						<tr><td width="20%">拍单号：P123456789</td><td width="30%"><span>应收车款：100000元</span><span>实收车款：80000元</span></td><td width="30%">应退车款：80000元</td><td width="20%">10000</td></tr>
 						<tr><td>退车赔款</td><td></td><td></td><td></td></tr>
 						<tr><td>违约扣款</td><td></td><td></td><td>扣除违约金：2000元</td></tr>
 						<tr><td>赔付</td><td></td><td>赔付<input type="text" value="" class="pei-money" /></td><td></td></tr>
 					</tbody>
 				</table>
 			</div>
 			<div class="yongBtn clearfix">
	            <input type="hidden" name="re_auction_type" value="">
	            <input type="hidden" name="first_money" value="">
	            <input type="submit" value="提交" class="queding">
	            <input class="quxiao" type="submit" value="返回">
        	</div>
        </div>        
    <div class="clear"></div>
</div>
<script>
	$(function(){
		$(".findings-audit input").click(function(){
			if($(this).index()==0){
				$(".cost-money1").hide();
				$(".reason-rejection").hide();
				$("h3.yonghu").eq(1).show();
				$(".arbitration").eq(1).show();
				$("h3.yonghu").eq(2).show();
				$(".refund").show();
				$(".cost-money").show();
				$(".arbitration").eq(2).hide();
				$(".arbitration").eq(1).find("table tbody tr:last").show();
				$(".arbitration").eq(1).find("div.change-reason").show();
				$(".arbitration").eq(1).find("div.change-reason1").hide();
				$(".arbitration").eq(3).hide();
				$("h3.yonghu").eq(3).hide();
			}else if($(this).index()==2){
				$(".arbitration").eq(1).hide();
				$(".cost-money1").hide();
				$(".cost-money").hide();
				$(".reason-rejection").show();
				$("h3.yonghu").eq(1).hide();
				$("h3.yonghu").eq(2).hide();
				$(".refund").hide();
				$(".arbitration").eq(2).hide();
				$("h3.yonghu").eq(3).hide();
				$(".arbitration").eq(3).hide();
			}else if($(this).index()==4){
				$(".arbitration").eq(2).show();
				$(".cost-money").hide();
				$(".cost-money1").show();
				$(".reason-rejection").hide();
				$("h3.yonghu").eq(1).show();
				$("h3.yonghu").eq(2).show();
				$("h3.yonghu").eq(3).hide();
				$(".refund").show();
				$(".arbitration").eq(1).show();
				$(".arbitration").eq(1).find("table tbody tr:last").hide();
				$(".arbitration").eq(1).find("div.change-reason1").show();
				$(".arbitration").eq(1).find("div.change-reason").hide();
				$(".arbitration").eq(2).find("span.cash-money").hide();
				$(".arbitration").eq(3).hide();
			}			
		})
		
		$(".compensate input").click(function(){
			if($(this).index()==0){
				$(".arbitration").eq(2).hide();
				$(".cost-money1").hide();
				$(".cost-money").show();
			}else if($(this).index()==2){
				$(".arbitration").eq(2).show();
				$(".cost-money1").show();
				$(".cost-money").hide();
			}
		})
		$(".change-reason1 input").click(function(){
			if($(this).index()==0){
				$(".arbitration").eq(2).find("span.cash-money1").show();
				$(".arbitration").eq(2).find("span.cash-money").hide();
				$("h3.yonghu").eq(3).hide();
				$(".arbitration").eq(3).hide();
				$(".refund").css("marginBottom","100px");
			}else if($(this).index()==2){				
				$(".arbitration").eq(2).find("span.cash-money1").hide();
				$(".arbitration").eq(2).find("span.cash-money").show();
				$("h3.yonghu").eq(3).show();
				$(".arbitration").eq(3).show();
				$(".refund").css("marginBottom","15px");
			}
		})
	})

	$(".queding").click(function(){
		var verify_res = $('input[name="adoptName"]:checked').val();
		if (verify_res == 1) {
			var modify_reason = $('input[name="testing"]:checked').val();
			var modify_desc = $('.change-describe').val();
			var modify_result = $('input[name="Payment"]:checked').val();
			if (modify_result == 1) {
				var payment_amount = $('input[name="payment_amount"]').val();
			}else if(modify_result == 2){
				var payment_amount = $('#voucher1').val();
			}
			//收款账号信息
			var account_name = $('input[name="account_name"]').val();
			var bank_account = $('input[name="bank_account"]').val();
			var bank_name =  $('input[name="bank_name"]').val();
			var param = {
				'modify_reason':modify_reason,
				'modify_desc':modify_desc,
				'modify_result':modify_result,
				'payment_amount':payment_amount,
				'account_name':account_name,
				'bank_account':bank_account,
				'bank_name':bank_name,
			}
			console.log(param);
			exit();
			$.post("/Dispute/disputePass/did/{$res.did}",param, function(data){
	     		console.log(data);
	        },"json");

		}
		else if (verify_res == 2) {
			var reject_result = $('#reject_result').val();
			$.post("/Dispute/disputeReject/did/{$res.did}",{'reject_result':reject_result}, function(data){
	     		console.log(data);
	        },"json");
		}
		else if (verify_res == 3) {   
			var buyDefault = $('input[name="buyDefault"]:checked').val();
			var modify_desc = $('.change-describe').val();
			var modify_result = $('input[name="Payment"]:checked').val();
			if (modify_result == 1) {
				var payment_amount = $('input[name="payment_amount"]').val();
			}else if(modify_result == 2){
				var payment_amount = $('#voucher1').val();
			}
			//收款账号信息
			var account_name = $('input[name="account_name"]').val();
			var bank_account = $('input[name="bank_account"]').val();
			var bank_name =  $('input[name="bank_name"]').val();
			var param = {
				'modify_reason':modify_reason,
				'modify_desc':modify_desc,
				'modify_result':modify_result,
				'payment_amount':payment_amount,
				'account_name':account_name,
				'bank_account':bank_account,
				'bank_name':bank_name,
			}
			$.post("/Dispute/disputeViolate/did/{$res.did}",param, function(data){
	     		console.log(data);
	        },"json");
		}else{
			return false; 
		}
	})
</script>
</body>
</html>